package com.ask.model;

import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.data.mongodb.core.mapping.Field;
import lombok.*;
import org.springframework.data.annotation.Id;

@Getter //(所有字段)
@Setter //(所有非final字段)
@Document(collection = "Answer")
public class Answer implements Serializable {

    @Id
    @Field("_id")
    //@JsonIgnore
    private String id;//By default the id in mongo collection is string.

    @ApiModelProperty(value = "问题id")
    private String questionId;

    @ApiModelProperty(value = "回答者id")
    private String answerId;

    @ApiModelProperty(value = "内容", required = true)
    private String content;

    @ApiModelProperty(value = "是否匿名")
    private Boolean anonymous;

    @ApiModelProperty(value = "相关网页链接")
    private String url;//可以为空

    @ApiModelProperty(value = "回答时间")
    private Date askTime;

    @ApiModelProperty(value = "被奖励金额")
    private double award; //在mongo里默认是0

    @ApiModelProperty(value = "图片链接")
    private String imgUrl;//可以为空

    @ApiModelProperty(value = "状态：0-待提交(草稿)；1->待付款(已提交)；2->已付款(无红包的直接是这个状态)；3->已删除；")
    private Integer status;

    @ApiModelProperty(value = "修改时间")
    private Date modifyTime;

    private static final long serialVersionUID = 1L;

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", modifyTime=").append(modifyTime);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}
